package top.wshape1.shiziapi.project.common.constant;

/**
 * @author Wshape1
 * @version 1.0
 * @description
 * @since 2023-10-22
 */

/**
 * @see top.wshape1.shiziapi.common.constant.DocTypeEnum
 */
public class DocumentConstant {

    public static final String API_TYPE = "api";
    public static final String MARKDOWN_TYPE = "markdown";
    public static final String RTF_TYPE = "rtf";
    public static final String FOLDER_TYPE = "folder";
    public static final String MINDMAP_TYPE = "mindmap";

    public static final int INT_API_TYPE = 0;
    public static final int INT_MARKDOWN_TYPE = 1;
    public static final int INT_RTF_TYPE = 2;
    public static final int INT_FOLDER_TYPE = 3;
    public static final int INT_MINDMAP_TYPE = 4;

    /*
    =============================
     */

    /**
     * ApiContent 标签：请求参数
     */
    public static final String REQ_PARAM_CONTENT_LABEL = "请求参数";

    /**
     * ApiContent 标签：响应参数
     */
    public static final String RES_PARAM_CONTENT_LABEL = "响应参数";

    /**
     * ApiContent 标签：说明/示例
     */
    public static final String DESC_CONTENT_LABEL = "说明/示例";

    public static final int PARAM_API_CONTENT_TYPE = 0;

    public static final int DESC_API_CONTENT_TYPE = 1;

    public static int typeStringToInt(String type) {
        if (type == null) {
            return -1;
        }
        return switch (type) {
            case API_TYPE -> INT_API_TYPE;
            case MARKDOWN_TYPE -> INT_MARKDOWN_TYPE;
            case RTF_TYPE -> INT_RTF_TYPE;
            case FOLDER_TYPE -> INT_FOLDER_TYPE;
            case MINDMAP_TYPE -> INT_MINDMAP_TYPE;
            default -> -1;
        };
    }

    public static String typeIntToString(int type) {
        return switch (type) {
            case INT_API_TYPE -> API_TYPE;
            case INT_MARKDOWN_TYPE -> MARKDOWN_TYPE;
            case INT_RTF_TYPE -> RTF_TYPE;
            case INT_FOLDER_TYPE -> FOLDER_TYPE;
            case INT_MINDMAP_TYPE -> MINDMAP_TYPE;
            default -> null;
        };
    }

}
